<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>图书信息添加</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery-3.2.1.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style>
        .form-group {
            margin-bottom: 0;
        }
    </style>
    <script>
        $(function () {
            $('#header').load('admin_header.html');
        })
    </script>
</head>
<body background="img/sky.jpg" style=" background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;">

<div id="header"></div>
<div style="position: relative;padding-top: 60px; width: 80%;margin-left: 10%">
    <form action="book_add_do.html" method="post" id="addbook">

        <table class="table table-hover">
            <tbody>
            <tr>
                <th width="10%">书名</th>
                <td><input type="text" class="form-control" name="name" id="name" placeholder="请输入书名"></td>
            </tr>
            <tr>
                <th>作者</th>
                <td><input type="text" class="form-control" name="author" id="author" placeholder="请输入作者名"></td>
            </tr>
            <tr>
                <th>出版社</th>
                <td><input type="text" class="form-control" name="publish" id="publish" placeholder="请输入出版社"></td>
            </tr>
            <tr>
                <th>ISBN</th>
                <td><input type="text" class="form-control" name="isbn" id="isbn" placeholder="请输入ISBN"></td>
            </tr>
            <tr>
                <th>简介</th>
                <td><input type="text" class="form-control" name="introduction" id="introduction"
                           placeholder="请输入简介"></td>
            </tr>
            <tr>
                <th>语言</th>
                <td>
                    <select class="form-control" name="language" >
                        <option value="中文">中文</option>
                        <option value="英语">英语</option>
                        <option value="日语">日语</option>
                        <option value="德语">德语</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th>价格</th>
                <td><input type="number" class="form-control" name="price" id="price" placeholder="请输入价格"></td>
            </tr>
            <tr>
                <th>出版日期</th>
                <%--默认为当前时间--%>
                <td><input type="date" class="form-control" name="pubstr" id="bt"/> </td>
            </tr>
            <tr>
                <th>分类号</th>
                <td><input type="number" class="form-control" name="classId" id="classId" min="1" max="22" placeholder="图书类别1~22"></td>
            </tr>
            <tr>
                <th>数量</th>
                <td><input type="number" class="form-control" name="number" id="number" min="1" placeholder="请输入图书数量"></td>
            </tr>
            </tbody>
        </table>

        <input type="submit" value="添加" class="btn btn-success btn-sm" class="text-left">
    <%--    <a href="admin_books.html">
            <button type="button" class="btn btn-success btn-sm">取消</button>
        </a>--%>
        <input type="button" class="btn btn-success btn-sm"  value="取消" onclick="javascript:history.go(-1);"/>
        <script>
            $("#addbook").submit(function () {
                if ($("#name").val() == '' || $("#author").val() == '' || $("#publish").val() == '' || $("#isbn").val() == '' || $("#introduction").val() == '' || $("#price").val() == ''  || $("#classId").val() == '' || $("#pressmark").val() == '' || $("#number").val() == '') {
                    alert("请填入完整图书信息！");
                    return false;
                }
            })

            //获取当前时间
            var date = new Date();
            var year = date.getFullYear();
            var month = date.getMonth() + 1;
            var day = date.getDate();
            if (month < 10) {
                month = "0" + month;
            }
            if (day < 10) {
                day = "0" + day;
            }
            var nowDate = year + "-" + month + "-" + day;
            var nowDate = nowDate.toString();
            $("#bt").val(nowDate);
        </script>
    </form>
</div>
</body>
</html>



<%--管理员   增加图书--%>
